<?php
/**
 * Created by PhpStorm.
 * Author: wenwenbin
 * Date: 2018/2/24
 * Time: 17:21
 */
namespace App\Http\Admin\Personnel\Controllers;

use Framework\BaseClass\Http\Admin\Controller;
use App\Http\Admin\Personnel\Models\Resume;

class ResumeController extends Controller
{
    public function resignPersonnelList()
    {
        $company_id = session('current_operation_company_id');
        if (!$company_id) xThrow(ERR_CURRENT_OPERATION_COMPANY_ID_NOT_EXIST);
        try {
            if (request()->isMethod('post')) {
                $paging = $this->getPagingRequestParameters();
                $employee = new Resume();
                return $employee->getResignPersonnelList($company_id, $paging);
            }
        } catch (\DebugError $e) {
            return $this->ajaxFail($e->getMessage());
        }
        return $this->view('resign-personnel-list');
    }
    
    public function joinTalentPool()
    {
        $params = request(['id']);
        try {
            $employee = new Resume();
            $result = $employee->saveTalentPool($params['id']);
            return $result ? $this->ajaxSuccess() : $this->ajaxFail();
        } catch (\DebugError $e) {
            return $this->ajaxFail($e->getMessage());
        }
    }
}